// 文件传输API的主要导出文件

// 便捷的工厂函数
import type { FileControllerApi } from '../openapi';

import { FileUpload } from './file-upload';
import { ShareCollection } from './share-collection';

export * from './file-chunk-packer';
export * from './file-chunk-uploader';
export * from './file-upload';
export * from './progress-status';
export * from './share-collection';
export * from './types';
export * from './utils';

/**
 * 创建文件上传实例
 */
export function createFileUpload(
  fileApi: FileControllerApi,
  chunkSize: number = 1024 * 1024,
): FileUpload {
  return new FileUpload(fileApi, chunkSize);
}

/**
 * 创建分享集合实例
 */
export function createShareCollection(
  fileApi: FileControllerApi,
  chunkSize: number = 1024 * 1024,
): ShareCollection {
  return new ShareCollection(fileApi, chunkSize);
}

/**
 * 默认配置
 */
export const DEFAULT_CHUNK_SIZE = 1024 * 1024; // 1MB
export const DEFAULT_MAX_RETRY = 5;
export const DEFAULT_FAIL_TIMEOUT = 60_000; // 60秒
